﻿//-----------------------------------------------------------------------
// <copyright file="PublishedFaultException.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Silverlight
{
    using System;

    using System.Security;
    using System.Security.Permissions;

    using System.ServiceModel;
    using System.ServiceModel.Channels;

    /// <summary>
    /// Represents a SOAP fault that has been successfully published.
    /// </summary>
    public class PublishedFaultException : FaultException, IPublishedException
    {
        #region public PublishedFaultException()

        /// <summary>
        /// Initializes a new instance of the <see cref="T:PublishedFaultException"/> class.
        /// </summary>
        public PublishedFaultException()
        {
        }

        #endregion

        #region public PublishedFaultException(Guid publicationId, MessageFault fault, string action) : base(fault, action)

        /// <summary>
        /// Initializes a new instance of the <see cref="PublishedFaultException"/> class using the specified message fault values and the provided action string.
        /// </summary>
        /// <param name="publicationId">The publication identifier of the SOAP fault.</param>
        /// <param name="fault">The message fault that contains the default SOAP fault values.</param>
        /// <param name="action">The action of the SOAP fault.</param>
        public PublishedFaultException(Guid publicationId, MessageFault fault, string action) : base(fault, action)
        {
            this.PublicationId = publicationId;
        }

        #endregion

        #region public PublishedFaultException(Guid publicationId, FaultReason reason, FaultCode code, string action) : base(reason, code, action)

        /// <summary>
        /// Initializes a new instance of the <see cref="T:PublishedFaultException"/> class using the specified fault reason, fault code, and the provided action string.
        /// </summary>
        /// <param name="publicationId">The publication identifier of the SOAP fault.</param>
        /// <param name="reason">The reason for the SOAP fault.</param>
        /// <param name="code">The fault code for the SOAP fault.</param>
        /// <param name="action">The action of the SOAP fault.</param>
        public PublishedFaultException(Guid publicationId, FaultReason reason, FaultCode code, string action) : base(reason, code, action)
        {
            this.PublicationId = publicationId;
        }

        #endregion

        #region public Guid PublicationId

        /// <summary>
        /// Gets the publication Id associated with the fault.
        /// </summary>
        public Guid PublicationId
        {
            get;
            private set;
        }

        #endregion        
    }
}
